package com.java.leetcode;

/**
 * @Author ynb
 * 	35 搜索插入位置
 * @Date 2021/5/31 16:51
 * @Version 1.0
 */
public class LeetCode035 {
    public int searchInsert(int[] nums, int target) {
        int index=0;
        int len=nums.length;
        for (;index<len;index++){
            if (nums[index] >= target){
                return  index;
            }
        }
        return len;
    }

    public static void main(String[] args) {
        LeetCode035 leetCode035 = new LeetCode035();
        int [] nums={1,3,5,6};
        int target = 2;
        int i = leetCode035.searchInsert(nums, target);
        System.out.println(i);
    }
}
